package com.yukh.test.javabase.net.demo1;

import java.net.InetAddress;

public class InetAdressDemo {
	public static void main(String[] args) {
		try {
			InetAddress ia = InetAddress.getLocalHost();
			ia = InetAddress.getByName("www.baidu.com");
			System.out.println(ia.getHostName());
			System.out.println(ia.getHostAddress());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
